import { RJSFSchema, UiSchema, ValidatorType } from '@rjsf/utils';
import { FormProps } from '@rjsf/core';
// 定义数据类型
export interface DialogType {
  title?: string;
  titleIcon?: string;
  onClose?: () => void;
  bodyClassName?: string;
  formClassName?: string;
  disabled?: boolean;
  width?: string;

  extraUiSchema?: UiSchema;
  validator?: ValidatorType;
  description?: string;
  submitText?: string;
  formData?: any;
  showCancel?: boolean;
  showSubmit?: boolean;
  submitLoading?: boolean;
  previewLoading?: boolean;
  isFormDataValid?: boolean;

  onSubmit?: (formData: any) => void;
  onPreview?: () => void;
  onCancel?: VoidFunction;
  customizeTitle?: JSX.Element;
  boxChildren?: JSX.Element;
  bodyChildren?: JSX.Element;
  footerChildren?: JSX.Element;
  placement?: CommandDialogPlacement;
}

export type DialogProps = Omit<
  FormProps<any, RJSFSchema, any>,
  'uiSchema' | 'validator' | 'onSubmit'
> &
  DialogType;

export type CommandDialogPlacement =
  | 'top'
  | 'bottom'
  | 'left'
  | 'right'
  | 'center'
  | 'topLeft'
  | 'bottomLeft'
  | 'topRight'
  | 'bottomRight';

// 定义数据类型
export type BoxProps = {
  title?: string;
  titleIcon?: string;
  width?: string;
  onClose?: () => void;
  bodyClassName?: string;
  disabled?: boolean;
  children?: JSX.Element;
  customizeTitle?: JSX.Element;
  placement?: CommandDialogPlacement;
  defaultPosition?: {
    x: number;
    y: number;
  };
};
